//统一管理项目接口的模块
//引入二次封装的axios（带有请求、响应的拦截器）
import requests from './require'
import mockRequests from './mockRequire.js'

// /api/product/getBaseCategoryList
export const reqCategoryList = () => requests({ url: '/product/getBaseCategoryList', method: 'get' })

export const reqGetBannerList = () => mockRequests({ url: '/banner', method: 'get' })

export const reqGetFloorList = () => mockRequests({ url: '/floor', method: 'get' })

// 获取搜索模块数据，地址：/api/list，请求方式：post
export const reqGetSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params })

// 获取商品详情数据，地址：/api/item/{skuId}，请求方式：get
export const reqGetGoodsInfo = (skuid) => requests({ url: `/item/${skuid}`, method: 'get' })

// 将产品添加到购物车中（或者对某一产品的数量进行更新）
export const reqAddorUpdataShopCart = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })

export const reqGetShopCartInfo = () => requests({ url: '/cart/cartList', method: 'get' })

// 删除购物车某产品的接口
export const reqDeleteCartById = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'delete' })

// 修改商品选中状态的接口
export const reqUpdateCheckedById = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' })

// 获取验证码的接口
export const reqGetCode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'get' })

// 注册新用户的接口
export const reqUserRegister = (data) => requests({ url: '/user/passport/register', data, method: 'post' })

// 注册新用户的接口
export const reqUserLogin = (data) => requests({ url: '/user/passport/login', data, method: 'post' })

// 获取用户信息，需要携带用户的woken向服务器要数据
export const reqUserInfo = () => requests({ url: '/user/passport/auth/getUserInfo', method: 'get' })

// 退出登录的接口
export const reqLogout = () => requests({ url: '/user/passport/logout', method: 'get' })






